package org.jeecg.modules.bigdatashow.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.bigdatashow.entity.Money;
import org.jeecg.modules.bigdatashow.entity.Ratio;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface MoneyMapper {
    @Select("SELECT y_ditch.name,money,ratio FROM y_ditch,y_history WHERE ditchid=#{i} AND y_history.`user_id`=y_ditch.`id`")
    List<Money> find(int i);

    @Select("select money from y_all where id=#{i}")
    String Allmoney(int i);

    @Select("SELECT COUNT(1) FROM y_history WHERE ditchid=#{i}")
    int cout(int i);

    @Select("SELECT y_ditch.`name`,ratio FROM y_ditch,y_history WHERE ditchid=#{i} AND y_history.`user_id`=y_ditch.`id` ORDER BY money desc LIMIT 1")
    Ratio findMax(int i);
    @Select("SELECT y_ditch.`name`,ratio FROM y_ditch,y_history WHERE ditchid=#{i} AND y_history.`user_id`=y_ditch.`id` ORDER BY money asc LIMIT 1")
    Ratio findMin(int i);
}
